﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="save" Then
	call savea
else
	call index
end if
end Function
Function index
	dim rs,sql,Runtxt,str
	Runtxt=qingtian.RunStr
	dim pid
    		pid = Request("pid")    
    		If pid = "" Then pid = 0
   		If Not IsNumeric(pid) Then pid = 0
    		pid = CLng(pid)
    		If pid < 0 Then pid = 0
dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

%>
	<card title="添加栏目"><p align="left">

	栏目名称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>" maxlength="50" value="" type="text"/><br/>
	栏目排序：<br/>
	<input emptyok="true"  name="nid<%=Runtxt%>" format="*N" value="" type="text"/><br/>
	栏目内容：<br/>
	<input emptyok="true"  name="content<%=Runtxt%>"  value="" type="text"/><br/>
	<anchor>确定提交
    	<go href="addcavet.asp?Action=save&amp;page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="nid" value="$(nid<%=Runtxt%>)"/>
        <postfield name="content" value="$(content<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>
<a href='cavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>'>返回栏目管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


Function savea
	dim pid
    		pid = Request("pid")    
    		If pid = "" Then pid = 0
   		If Not IsNumeric(pid) Then pid = 0
    		pid = CLng(pid)
    		If pid < 0 Then pid = 0

dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

		dim name,content,nid,errs,rs,sql
		name=Request.form("name")
		nid=Request.form("nid")
		content=Request.form("content")

		errs=""
		if name="" then errs=errs & "栏目名称不能为空<br/>"
		if nid="" then errs=errs & "栏目排序不能为空<br/>"
		if content="" then errs=errs & "栏目内容不能为空<br/>"

	IF len(errs)=0 then


		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select  * FROM qingtian_showclass"
		rs.open sql,conn,1,3
		rs.addnew
			rs("name")=name
			rs("pid")=pid
			rs("nid")=nid
			rs("content")=content
		rs.update()
		rs.Close
		Set rs = Nothing
	%>
<card title="修改栏目"><p align="left">
		添加栏目成功!<br/><%

	else%>

	<card title="修改栏目"><p align="left">
		<%=errs%>
		<a href="addcavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='addcavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>'>返回添加栏目</a><br/>
<a href='cavet.asp?page=<%=page%>&amp;pid=<%=pid%>&amp;sid=<%=sid%>'>返回栏目管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function
%>
